package at.fhj.swd;

import java.util.ArrayList;
import java.util.Collections;

/**
 * Implementation of MainFlowers
 * 
 * @author  bernadette.pecovnik
 * @version 1.0
 */
public class MainFlowers {

   /**
    * Main Method that uses Comparator Class <code>SortByPrice</code>.
    * New Roses are initialized and added to an Array List. Items of ArrayList get sorted 
    * by price by Comparator Class <code>SortByPrice</code>. Sorted items are printed
    * with method <code>printFlower</code>.
    * 
    * @param args
    */
	public static void main(String[] args) {
		
		// Rose initialized with Id 1, Color "gelb" and a price of 13,25
        Rose rose1 = new Rose("gelb", 1, 13.25);
		// Rose initialized with Id 2, Color "rot" and a price of 15,80
        Rose rose2 = new Rose("rot", 2, 15.80);
		// Rose initialized with Id 3, Color "weiss" and a price of 9,90
        Rose rose3 = new Rose("weiss", 3, 9.90);
		// Rose initialized with Id 4, Color "rosa" and a price of 12,25
        Rose rose4 = new Rose("rosa", 4, 12.35);
		// Rose initialized with Id 5, Color "schwarz" and a price of 11,40
        Rose rose5 = new Rose("schwarz", 5, 11.40);
        
        // Initialize new Array List rosesList 
		ArrayList<Rose> rosesList = new ArrayList<Rose>();
		// Add roses to Array List rosesList
		rosesList.add(rose1);
		rosesList.add(rose2);
		rosesList.add(rose3);
		rosesList.add(rose4);
		rosesList.add(rose5);

		// Sort items in rosesList with SortByPreis
		Collections.sort(rosesList, new SortByPrice());

		// Loop through rosesList
		for (int i = 0; i < rosesList.size(); i++) {
			// print attributes of rose with method printFlower
			rosesList.get(i).printFlower();
		}

	}

}
